<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <p>本次提交审核数量：{{ this.selectedRowKeys.split(',').length }}</p>
    <p>确认提交吗？</p>
  </j-modal>
</template>

<script>
import { httpAction, getAction } from '@/api/manage'
export default {
  name: 'EneFaultRepairBatchSupplyModal',
  components: {},
  data() {
    return {
      title: '批量审核',
      width: 800,
      visible: false,
      disableSubmit: false,
      selectedRowKeys: ''
    }
  },
  methods: {
    check(record) {
      this.visible = true
      this.selectedRowKeys = record
    },
    handleOk: function(...e) {
      let that = this
      that.confirmLoading = true
      let method = 'put'
      let checkUrl = '/repair/eneFaultRepair/batchSupply'
      httpAction(checkUrl + '?ids=' + this.selectedRowKeys, {}, method)
        .then(res => {
          this.visible = false
          if (res.success) {
            that.$message.success(res.message)
            that.$emit('ok')
          } else {
            that.$message.warning(res.message)
          }
        })
        .finally(() => {
          that.confirmLoading = false
        })
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>
